package xin.marcher.module.common.constants.message;

/**
 * 缓存key
 */
public abstract class AbstractRedisKeyConstants {

    private AbstractRedisKeyConstants() {
        throw new IllegalStateException("AbstractRedisKeyConstants class");
    }

    /**
     * 数据变更监听表配置 缓存
     * key：tableName
     */
    public static final String DATA_CHANGE_LISTEN_CONFIG_STRING = "DATA_CHANGE_LISTEN_CONFIG_STRING:%s";

    /**
     * 监听表变化字段配置 缓存
     * key：tableName
     */
    public static final String DATA_CHANGE_COLUMN_CONFIG_STRING = "DATA_CHANGE_COLUMN_CONFIG_STRING:%s";

    /**
     * 监听表消息模型 缓存
     * key：tableName
     */
    public static final String DATA_CHANGE_MESSAGE_CONFIG_STRING = "DATA_CHANGE_MESSAGE_CONFIG_STRING:%s";

    /**
     * 数据溯源监听表配置 缓存
     * key：tableName
     */
    public static final String DATA_TRACE_LISTEN_CONFIG_STRING = "DATA_TRACE_LISTEN_CONFIG_STRING:%s";

    public static String getListenConfigStringKey(String tableName) {
        return String.format(DATA_CHANGE_LISTEN_CONFIG_STRING, tableName);
    }

    public static String getColumnConfigStringKey(Long listenId) {
        return String.format(DATA_CHANGE_COLUMN_CONFIG_STRING, listenId);
    }

    public static String getMessageConfigStringKey(Long listenId) {
        return String.format(DATA_CHANGE_MESSAGE_CONFIG_STRING, listenId);
    }

    public static String getTraceListenConfigStringKey(String tableName) {
        return String.format(DATA_TRACE_LISTEN_CONFIG_STRING, tableName);
    }
}
